#Validate Subsequence

#[1, 2, 3, 4]
# ^arrayIdx
#[1, 2] True
# ^seqIdx

#[1, 2, 4] True
#[2, 4] True
#[2, 1] False
#[4, 2] False
#[1, 2, 3, 4] True
#Subsequence
# * Same elements
# * Same orders

# One sentance discription.

# Write a function which take two parameters(参数)：
# Parameters:
# - origin array
# - subsequence
# Return: Bool
# If subsequence is a valid subsequence of the origin array
def validateSubsequence(array, subsequence):
    arrayIdx = 0
    seqIdx = 0

    while arrayIdx < len(array) and seqIdx < len(subsequence):
        if array[arrayIdx] == subsequence[seqIdx]:
            seqIdx += 1

        arrayIdx += 1

    return seqIdx == len(subsequence)
    